package com.xywy.beautyand.vollery;
//package com.xywy.tangandroid.vollery;
//
//import android.graphics.Bitmap;
//import android.graphics.drawable.BitmapDrawable;
//import android.graphics.drawable.Drawable;
//import android.graphics.drawable.TransitionDrawable;
//import android.widget.ImageView;
//
//import com.android.volley.VolleyError;
//import com.android.volley.toolbox.ImageLoader;
//import com.android.volley.toolbox.ImageLoader.ImageContainer;
//import com.xywy.tangandroid.ASApplication;
//import com.xywy.tangandroid.util.ImageUtil;
//
//public class ImageLoadListener implements ImageLoader.ImageListener{
//	private ImageView imageView;
//	private Drawable defaultDrawable;
//	private Drawable errorDrawable;
//	private boolean isImmediateShowImage;
//	private int corner = 0;
//	
//	public ImageLoadListener(ImageView imageView,Drawable defaultDrawable, Drawable errorDrawable){
//		this.imageView = imageView;
//		this.defaultDrawable = defaultDrawable;
//		this.errorDrawable = errorDrawable;
//	}
//	
//	public ImageLoadListener(ImageView imageView,Drawable defaultDrawable, Drawable errorDrawable,int corner){
//		this.imageView = imageView;
//		this.defaultDrawable = defaultDrawable;
//		this.errorDrawable = errorDrawable;
//		this.corner = corner;
//		this.isImmediateShowImage = true;
//	}
//	public ImageLoadListener(ImageView imageView,Drawable defaultDrawable, Drawable errorDrawable,boolean isImmediateShowImage){
//		this.imageView = imageView;
//		this.defaultDrawable = defaultDrawable;
//		this.errorDrawable = errorDrawable;
//		this.isImmediateShowImage = isImmediateShowImage;
//	}
//	public ImageLoadListener(ImageView imageView,Drawable defaultDrawable, Drawable errorDrawable,boolean isImmediateShowImage,int corner){
//		this.imageView = imageView;
//		this.defaultDrawable = defaultDrawable;
//		this.errorDrawable = errorDrawable;
//		this.isImmediateShowImage = isImmediateShowImage;
//		this.corner = corner;
//	}
//
//	@Override
//	public void onErrorResponse(VolleyError error) {
//		if (errorDrawable != null) {
//			imageView.setImageDrawable(errorDrawable);
//		}
//	}
//
//	@Override
//	public void onResponse(ImageContainer response, boolean isImmediate) {
//		Bitmap bitmap = response.getBitmap();
//		isImmediate = this.isImmediateShowImage;
//		if (bitmap != null) {
////			if(corner!=0)bitmap = ImageUtil.toRoundCorner(bitmap, corner);
////			if (!this.isImmediateShowImage && defaultDrawable != null) {
////				// 閫愭笎鏄剧ず鍥剧�?
////				TransitionDrawable transitionDrawable = new TransitionDrawable(
////						new Drawable[] {
////								defaultDrawable,
////								new BitmapDrawable(ASApplication.application
////										.getResources(),
////										RoundedBitmapDisplayer.roundCorners(bitmap, imageView, corner)) });
////				transitionDrawable.setCrossFadeEnabled(true);
////				imageView.setImageDrawable(transitionDrawable);
////				transitionDrawable.startTransition(300);
////			} else {
////				imageView.setImageBitmap(bitmap);
////			}
//		} else if (defaultDrawable != null) {
//			imageView.setImageDrawable(defaultDrawable);
//		}
//		
//	}
//
//	/**
//	 * 该动画效果�?用于ImageView的scaleType为fitXY的情况，即正方形图片的加载，否则
//	 * 当defaultDrawable和实际的bitmap宽高不一致时，会出现压缩和拉伸的问题
//	 */
////	@Override
////	public void onResponse(ImageContainer response, boolean isImmediate) {
////		Bitmap bitmap = response.getBitmap();
////		isImmediate = this.isImmediateShowImage;
////		if (bitmap != null) {
////			if(corner!=0)bitmap = ImageUtil.toRoundCorner(bitmap, corner);
////			if (!this.isImmediateShowImage && defaultDrawable != null) {
////				// 閫愭笎鏄剧ず鍥剧�?
////				TransitionDrawable transitionDrawable = new TransitionDrawable(
////						new Drawable[] {
////								defaultDrawable,
////								new BitmapDrawable(ASApplication.application
////										.getResources(),
////										RoundedBitmapDisplayer.roundCorners(bitmap, imageView, corner)) });
////				transitionDrawable.setCrossFadeEnabled(true);
////				imageView.setImageDrawable(transitionDrawable);
////				transitionDrawable.startTransition(300);
////			} else {
////				imageView.setImageBitmap(bitmap);
////			}
////		} else if (defaultDrawable != null) {
////			imageView.setImageDrawable(defaultDrawable);
////		}
////	}
//	
//}